<?php if ($this->posts_list) { ?>
<?php foreach($this->posts_list as $key => $val) { ?>
<li>
	<div class="mod-head">
	<div class="font16">
		<?php if ($val['question_id']) { ?>
		<?php if ($val['answer_count'] > 0) { ?>
			<?php if ($val['answer_info']['anonymous']) { ?>
				<a href="javascript:;"><img class="img" src="<?php echo G_STATIC_URL; ?>/common/avatar-max-img.png" alt="" width="20" /></a>
			<?php } else { ?>
				<a data-id="<?php echo $val['answer_info']['user_info']['uid']; ?>" href="people/<?php echo $val['answer_info']['user_info']['url_token']; ?>" rel="nofollow"><img class="img" src="<?php echo get_avatar_url($val['answer_info']['user_info']['uid'], 'max'); ?>" alt="" width="20" /></a>
			<?php } ?>
		<?php } else { ?>
			<?php if ($val['anonymous'] == 0) { ?>
				<a data-id="<?php echo $val['user_info']['uid']; ?>" href="people/<?php echo $val['user_info']['url_token']; ?>" rel="nofollow"><img class="img" src="<?php echo get_avatar_url($val['user_info']['uid'], 'max'); ?>" alt="" width="20" /></a>
			<?php } else { ?>
				<a><img width="20" src="<?php echo G_STATIC_URL; ?>/common/avatar-max-img.png" alt="<?php _e('匿名用户'); ?>" title="<?php _e('匿名用户'); ?>" /></a>
			<?php } ?>
		<?php } ?>
		<?php } ?>
		<?php if ($val['question_id']) { ?>
		<?php if ($val['answer_count'] > 0) { ?>
			<?php if ($val['answer_info']['anonymous']) { ?><a href="javascript:;"><?php _e('匿名用户'); ?></a><?php } else { ?><a href="m/people/<?php echo $val['answer_info']['user_info']['url_token']; ?>"><?php echo $val['answer_info']['user_info']['user_name']; ?></a><?php } ?> <?php _e('回复了问题'); ?>
				<span class="pull-right color-999"><?php echo date_friendly($val['update_time'], 604800, 'Y-m-d'); ?></span>
		<?php } else { ?>
			<?php if ($val['anonymous'] == 0) { ?><a href="m/people/<?php echo $val['user_info']['url_token']; ?>"><?php echo $val['user_info']['user_name']; ?></a><?php } else { ?><a href="javascript:;"><?php _e('匿名用户'); ?></a><?php } ?> <?php _e('发起了问题'); ?>
				<span class="pull-right color-999"><?php echo date_friendly($val['add_time'], 604800, 'Y-m-d'); ?></span>
		<?php } ?>
		<?php } else { ?>
			<a href="m/people/<?php echo $val['user_info']['url_token']; ?>"><img class="img" src="<?php echo get_avatar_url($val['user_info']['uid'], 'max'); ?>" alt="" width="20" /><?php echo $val['user_info']['user_name']; ?></a>
			<?php _e('发起了文章'); ?>
			<span class="pull-right color-999"><?php echo date_friendly($val['add_time'], 604800, 'Y-m-d'); ?></span>
		<?php } ?>
	</div>
	</div>
	<div class="mod-body">
		<?php if ($val['question_id']) { 
		$ts=$val['question_content'];?>
			<h2><a href="m/question/<?php echo $val['question_id']; ?>"><?php echo $val['question_content']; ?></a></h2>
		<?php } else { 
		$ts=$val['title'];?>
			<h2><a href="m/article/<?php echo $val['id']; ?>"><?php echo $val['title']; ?></a></h2>
		<?php } ?>
	<?php if (!$val['question_id']&&$val['message']) { 
	$str = FORMAT::ubbfirebox($val['message']);?>
		<?php echo strip_tags(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode(cjk_substr($str, 0, 80, 'UTF-8', '...'))))); ?>
	<?php }elseif($val['question_detail']){ 
	$str = FORMAT::ubbfirebox($val['question_detail']);?>
		<?php echo strip_tags(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode(cjk_substr($str, 0, 80, 'UTF-8', '...'))))); ?>
	<?php } ?>
	<?php if ($val['attachs']) {?>
	<div class="boxs row">
		<?php 
		$atnum=($val['attachs'])?count($val['attachs']):'1';
		if($atnum>4 && $atnum<12){
			$atnums=floor(12/$atnum*2);
		}elseif($atnum>=12){
			$atnums=2;
		}elseif($atnum==4){
			$atnums=3;
		}else{
			$atnums=4;
		}	
		foreach($val['attachs'] AS $attach) { ?>
		<div class="shibox col-xs-<?php echo $atnums;?> col-sm-<?php echo $atnums;?> col-md-<?php echo $atnums;?>">
			<a href="<?php echo $attach['attachment']; ?>" target="_blank">
			<img class="img-polaroidst img-responsive" src="<?php echo $attach[thumb]; ?>" alt="<?php echo $attach['file_name']; ?>" />
			</a>
		</div>
		<?php }?>
	</div>
	<?php }else{
		$body=($val['question_detail'])?$val['question_detail']:$val['message'];
		$img_array = array();
		preg_match_all("/\[img\](.*?)\[\/img\]/i",$body,$img_array);
		$img_array = array_unique($img_array[1]);
		if(count($img_array)>0){?>
		<div class="inners clearfix">
		<div class="row">
			<?php
			$atnums=4;		
			foreach($img_array AS $key => $attach) {
			if($key<3){
			$im='h=300';?>
			<div class="shibox shiboximg col-xs-<?php echo $atnums;?> col-sm-<?php echo $atnums;?> col-md-<?php echo $atnums;?>">
				<a href="<?php echo $attach; ?>" target="_blank" data-fancybox-group="thumb" rel="lightbox">
				<img class="img-polaroidst img-responsive" src="<?php echo base_url().'/plugins/st.php?src='.$attach."&".$im."&zc=1";?>" alt="<?php echo $attach; ?>" />
				</a>
			</div>
			<?php }}?>
		</div>
		</div>
		<?php }}?>
	</div>
	<div class="mod-footer">
		<?php if ($val['question_id']) { ?>
			<span class="text-color-999"><i class="icon icon-wechat"></i><?php _e('回复 %s ', $val['answer_count']); ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php _e('关注 %s ', $val['focus_count']); ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php _e('浏览 %s ', $val['view_count']); ?> 
			</span>
		<?php } else { ?>
			<span class="text-color-999"><i class="icon icon-wechat"></i><?php _e('评论 %s ', $val['comments']); ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php _e('浏览 %s ', $val['views']); ?></span>
		<?php } ?>
	</div>

</li>
<?php } ?>
<?php } ?>